import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios';
import { Configuration } from '../configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; 
import { Supplier,ResultListSupplier } from '../models'; 

/**
 * SupplierApi - axios parameter creator
 * @export
 */
 export const SupplierApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary 增加
         * @param {AddPosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        apiSupplierAddPost: async (body?: Supplier, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/Supplier/add`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication Bearer required

            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';

            const query = new URLSearchParams(localVarUrlObj.search);
            for (const key in localVarQueryParameter) {
                query.set(key, localVarQueryParameter[key]);
            }
            for (const key in options.params) {
                query.set(key, options.params[key]);
            }
            localVarUrlObj.search = (new URLSearchParams(query)).toString();
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary 删除
         * @param {DeletePosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        apiSupplierDeletePost: async (body?: Supplier, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/Supplier/delete`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication Bearer required

            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';

            const query = new URLSearchParams(localVarUrlObj.search);
            for (const key in localVarQueryParameter) {
                query.set(key, localVarQueryParameter[key]);
            }
            for (const key in options.params) {
                query.set(key, options.params[key]);
            }
            localVarUrlObj.search = (new URLSearchParams(query)).toString();
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary 获取列表
         * @param {any} [pars] 参数 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        apiSupplierListGet: async (pars?:any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/Supplier/page`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any; 

            // authentication Bearer required
 
            const query = new URLSearchParams(localVarUrlObj.search);
            for (const key in pars) {
                query.set(key, pars[key]);
            }
            for (const key in options.params) {
                query.set(key, options.params[key]);
            }
            localVarUrlObj.search = (new URLSearchParams(query)).toString();
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary 更新
         * @param {UpdatePosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        apiSupplierUpdatePost: async (body?: Supplier, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/Supplier/edit`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication Bearer required

            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';

            const query = new URLSearchParams(localVarUrlObj.search);
            for (const key in localVarQueryParameter) {
                query.set(key, localVarQueryParameter[key]);
            }
            for (const key in options.params) {
                query.set(key, options.params[key]);
            }
            localVarUrlObj.search = (new URLSearchParams(query)).toString();
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * SupplierApi - functional programming interface
 * @export
 */
export const SupplierApiApiFp = function(configuration?: Configuration) {
    return {
        /**
         * 
         * @summary 增加
         * @param {AddPosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierAddPost(body?: Supplier, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
            const localVarAxiosArgs = await SupplierApiAxiosParamCreator(configuration).apiSupplierAddPost(body, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * 
         * @summary 删除
         * @param {DeletePosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierDeletePost(body?: Supplier, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
            const localVarAxiosArgs = await SupplierApiAxiosParamCreator(configuration).apiSupplierDeletePost(body, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * 
         * @summary 获取列表
         * @param {string} [name] 名称
         * @param {string} [code] 编码
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierListGet(pars?:any,options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResultListSupplier>>> {
            const localVarAxiosArgs = await SupplierApiAxiosParamCreator(configuration).apiSupplierListGet(pars, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * 
         * @summary 更新
         * @param {UpdatePosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierUpdatePost(body?: Supplier, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
            const localVarAxiosArgs = await SupplierApiAxiosParamCreator(configuration).apiSupplierUpdatePost(body, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
    }
};

/**
 * SupplierApi - factory interface
 * @export
 */
export const SupplierApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    return {
        /**
         * 
         * @summary 增加
         * @param {AddPosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierAddPost(body?: Supplier, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
            return SupplierApiApiFp(configuration).apiSupplierAddPost(body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary 删除
         * @param {DeletePosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierDeletePost(body?: Supplier, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
            return SupplierApiApiFp(configuration).apiSupplierDeletePost(body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary 获取列表
         * @param {string} [name] 名称
         * @param {string} [code] 编码
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierListGet(name?: string, code?: string, options?: AxiosRequestConfig): Promise<AxiosResponse<ResultListSupplier>> {
            return SupplierApiApiFp(configuration).apiSupplierListGet(name, code, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary 更新
         * @param {UpdatePosInput} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async apiSupplierUpdatePost(body?: Supplier, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
            return SupplierApiApiFp(configuration).apiSupplierUpdatePost(body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * SupplierApi - object-oriented interface
 * @export
 * @class SupplierApi
 * @extends {BaseAPI}
 */
export class SupplierApi extends BaseAPI {
    /**
     * 
     * @summary 增加
     * @param {AddPosInput} [body] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof SysPosApi
     */
    public async apiSupplierAddPost(body?: Supplier, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
        return SupplierApiApiFp(this.configuration).apiSupplierAddPost(body, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * 
     * @summary 删除
     * @param {DeletePosInput} [body] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof SysPosApi
     */
    public async apiSupplierDeletePost(body?: Supplier, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
        return SupplierApiApiFp(this.configuration).apiSupplierDeletePost(body, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * 
     * @summary 获取列表
     * @param {string} [name] 名称
     * @param {string} [code] 编码
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof SysPosApi
     */
    public async apiSupplierListGet(pars?:any, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResultListSupplier>> {
        return SupplierApiApiFp(this.configuration).apiSupplierListGet(pars, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * 
     * @summary 更新
     * @param {UpdatePosInput} [body] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof SysPosApi
     */
    public async apiSupplierUpdatePost(body?: Supplier, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
        return SupplierApiApiFp(this.configuration).apiSupplierUpdatePost(body, options).then((request) => request(this.axios, this.basePath));
    }
}
